﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.Command;
using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Unity;
using Tww.Paf.Api.Components.NavigationMenu;
using Tww.Wpf.Controls.Controls.Common;

namespace ExampleModule.Views
{
    /// <summary>
    /// Interaktionslogik für MenuTestView.xaml
    /// </summary>
    public partial class MenuTestView : IMenuTestView
    {
        public MenuTestView()
        {
            this.InitializeComponent();
        }

        public MenuTestView(IUnityContainer unityContainer)
        {
            this.InitializeComponent();
            this.DataContext = this;
            this.UnityContainer = unityContainer;
        }

        public IUnityContainer UnityContainer { get; set; }


        public Tww.Wpf.Controls.Controls.Menus.ExpandMenu.ExpandMenu MenuTest { get { return this.Menu; } }

        private ICommand closeMenuCommand;
        public ICommand CloseMenuCommand
        {
            get
            {
                return closeMenuCommand ?? (closeMenuCommand = new RelayCommand(CloseMenu));
            }
        }

        private void CloseMenu()
        {
            var menuService = UnityContainer.Resolve<INavigationMenuService>();

            if (menuService != null)
            {
                menuService.CloseNavigationMenu();
            }
        }
    }
}
